<template>
  <div class="question_container">
    <div class="left_answer_num_wrap">
      <p class="num">{{ num }}</p>
      <span>回答</span>
    </div>
    <div class="right_question_wrap cursor_class" @click="() => { router.push({ name: 'faq-detail', params: { id } }) }">
      <div class="top_quest_title text_ellipsis">{{ title }}</div>
      <div class="bottom_quest_content">
        <div class="quest_desc text_ellipsis text_muted">
          {{ desc }}
        </div>
        <div class="quest_esb">
          <div class="left_esb hidden-xs-only">
            <div class="tag_section">
              <template v-if="tags">
                <el-tag class="esb_tag_item" v-for="item in tags.split(',')" :key="item">
                  {{ item }}
                </el-tag>
              </template>
            </div>
            <div class="esb_seciton">
              <div class="esb_item">
                <el-icon>
                  <View />
                </el-icon>
                <span>{{ viewNumber }}</span>
              </div>
              <div class="esb_item">
                <el-icon>
                  <Timer />
                </el-icon>
                <span>{{ time }}</span>
              </div>
            </div>
          </div>
          <div class="right_author">
            <span>{{ author }}</span>
            <!-- <span style="margin-left:12px">采纳率：66.7%</span> -->
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import {
  View,
  Timer,
} from '@element-plus/icons-vue'
import { ref, toRefs } from 'vue'
import router from '@/router'
const props = defineProps({
  id: {
    type: String,
    default: '',
    require: true
  },
  // 回答数
  num: {
    type: Number,
    default: 0,
  },
  // 问答标题
  title: {
    type: String,
    default: '',
  },
  // 描述
  desc: {
    type: String,
    default: '',
  },
  // ；浏览数量
  viewNumber: {
    type: Number,
    default: 0,
  },
  // 时间
  time: {
    type: String,
    default: '',
  },
  // 作者
  author: {
    type: String,
    default: '',
  },
  tags: {
    type: String,
    default: '',
  }
})
</script>

<style lang="scss" scoped>
.question_container {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #eee;

  &:last-child {
    border-bottom: 0;
  }

  .left_answer_num_wrap {
    text-align: center;
    color: #555666;
    min-width: 55px;
    margin-right: 10px;
    margin-bottom: 10px;

    .num {
      font-size: 18px;
      margin-bottom: 4px;
      margin-top: 0;
    }

    span {
      font-size: 14px;
    }
  }

  .right_question_wrap {
    overflow: hidden;
    flex: 1;

    .top_quest_title {
      color: #222226;
      font-weight: 700;
      font-size: 18px;
      margin-bottom: 10px;

      &:hover {
        opacity: .8;
      }
    }

    .bottom_quest_content {
      .quest_desc {
        // margin-bottom: 10px;
      }

      .quest_esb {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        
        .left_esb {
          display: flex;
          flex-wrap: wrap;

          .tag_section {
            margin-right: 10px;

            .esb_tag_item {
              margin-right: 10px;
              margin-bottom: 10px;
              margin-top: 10px;
            }
          }

          .esb_seciton {
            display: flex;
            align-items: center;
            flex-wrap: wrap;

            .esb_item {
              margin-right: 20px;
              display: flex;
              align-items: center;
              color: rgba(0, 0, 0, 0.45098039215686275);
              font-size: 14px;

              span {
                margin-left: 4px;
              }
            }
          }
        }

        .right_author {
          display: flex;
          justify-content: flex-end;

          // flex-wrap: wrap;
          span {
            margin-bottom: 10px;
            margin-top: 10px;
            color: #999AAA;
          }
        }
      }
    }
  }
}
</style>
